package com.dong.bean;

import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PostConstruct;
import java.io.Closeable;
import java.io.IOException;

/**
 * description
 *
 * @author Administrator 2021/08/30 10:44
 */
public class MyDisposableBean implements DisposableBean,AutoCloseable{

    private MyInitializingBean myInitializingBean;

    public void init(){
        System.out.println("init方法");
    }

    @PostConstruct
    public void postConstruct(){
        System.out.println("MyDisposableBean--postConstruct");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean--Destroy");
    }

    public void cleanup(){
        System.out.println("cleanup方法");
    }

    @Override
    public void close() throws IOException {
        System.out.println("close");
    }

    public void print(){
        myInitializingBean.print();
    }

    public MyInitializingBean getMyInitializingBean() {
        return myInitializingBean;
    }

    public void setMyInitializingBean(MyInitializingBean myInitializingBean) {
        this.myInitializingBean = myInitializingBean;
    }
}
